package com.java.zjx.action;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;


public class Login extends ActionSupport {
	private String userName;
	private String password;
	private String DropExpiration;
	
	
	
	@Override
	public String execute() throws Exception {
		String name = "zjx";
		String pw = "hahaha";
		int day = 1;
		Cookie cookie1 = new Cookie("uname",name);
		Cookie cookie2 = new Cookie("upass",pw);
		cookie1.setMaxAge(day*24*60*60);
		cookie2.setMaxAge(day*24*60*60);
		System.out.println(userName);
		System.out.println(password);
		System.out.println(DropExpiration);
		HttpServletResponse  response = ServletActionContext.getResponse();
		response.addCookie(cookie1);
		response.addCookie(cookie2);
		return SUCCESS;
	}
	
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public void setDropExpiration(String dropExpiration) {
		DropExpiration = dropExpiration;
	}
	
	
	
}
